summaryrefslogtreecommitdiff
path: root/app/[lng]/engineering/(engineering)/project-gtc/page.tsx
blob: 8e12a4894fc275fb95516dd9b0e7f2cf51e52545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as React from "react"
import { type SearchParams } from "@/types/table"

import { Skeleton } from "@/components/ui/skeleton"
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
import { Shell } from "@/components/shell"
import { getProjectGtcList } from "@/lib/project-gtc/service"
import { projectGtcSearchParamsSchema } from "@/lib/project-gtc/validations"
import { ProjectGtcTable } from "@/lib/project-gtc/table/project-gtc-table"

interface IndexPageProps {
  searchParams: Promise<SearchParams>
}

export default async function IndexPage(props: IndexPageProps) {
  const searchParams = await props.searchParams
  const search = projectGtcSearchParamsSchema.parse(searchParams)

  const promises = Promise.all([
    getProjectGtcList({
      page: search.page,
      perPage: search.perPage,
      search: search.search,
      sort: search.sort,
    }),
  ])

  return (
    <Shell className="gap-2">
      <div className="flex items-center justify-between space-y-2">
        <div className="flex items-center justify-between space-y-2">
          <div>
            <h2 className="text-2xl font-bold tracking-tight">
              Project GTC 
            </h2>
            <p className="text-muted-foreground">
              프로젝트별 GTC(General Terms and Conditions) 파일을 관리할 수 있습니다. 
              각 프로젝트마다 하나의 GTC 파일을 업로드할 수 있으며, 파일 업로드 시 기존 파일은 자동으로 교체됩니다.
            </p>
          </div>
        </div>
      </div>

      <React.Suspense fallback={<Skeleton className="h-7 w-52" />}>
        {/* 추가 기능이 필요하면 여기에 추가 */}
      </React.Suspense>
      
      <React.Suspense
        fallback={
          <DataTableSkeleton
            columnCount={8}
            searchableColumnCount={1}
            filterableColumnCount={2}
            cellWidths={["3rem", "3rem", "12rem", "20rem", "10rem", "20rem", "15rem", "12rem", "3rem"]}
            shrinkZero
          />
        }
      >
        <ProjectGtcTable promises={promises} />
      </React.Suspense>
    </Shell>
  )
}